package com.kafka.demo;

import kafka.consumer.Consumer;
import kafka.consumer.ConsumerConfig;
import kafka.consumer.ConsumerConnector;

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

/**
 * =================================
 * <p>
 * Created by cjj on 2018/10/17.
 * <p>
 * 描述: 消费者
 */

public class Customer {


    public static void main(String[] args) {

        Properties properties = new Properties();

        properties.setProperty("zookeeper.connect","cj.sun.hadoop1:2181,cj.sun.hadoop2:2181");
        properties.setProperty("group.id","111");
        properties.setProperty("auto.offset.reset","smallest");

        ConsumerConfig consumerConfig = new ConsumerConfig(properties);

        ConsumerConnector consumerConnector = Consumer.create(consumerConfig);
        Map<String,Integer> map = new HashMap();
        map.put("order",2);
        map.put("mygirls",1);
        map.put("myboys",2);

        //Map<String, List<KafkaStream<byte[], byte[]>>> messageStreams = consumerConnector.createMessageStreams(map);

        //<KafkaStream<byte[], byte[]>> mygirls = messageStreams.get("mygirls");


    }

}
